# Django 表单
from django.http import HttpResponse
from django.shortcuts import render


# 表单
def search_Form(request):
    return render(request, 'searchForm.html')


# 接收Get 请求数据
def searchGet(request):
    request.encoding = 'utf-8'
    if 'q' in request.GET and request.GET['q']:
        message = '你搜索的内容为: ' + request.GET['q']
    else:
        message = '你提交了空表单'
    return HttpResponse('<p>'+message+'</p>')


# 接收Post 请求数据
def searchPost(request):
    ctx ={}
    if request.POST:
        ctx['rlt'] = request.POST['q']
    return render(request, "searchForm.html", ctx)